package cn.fighter3.service.impl;

import cn.fighter3.entity.node.*;
import cn.fighter3.service.node.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {

    @Autowired
    BookDao bookDao;
    public List<Book> findAll(){
        return (List<Book>) bookDao.findAll();
    }

    @Autowired
    CnbookDao cnbookDao;
    //增加
    public Cnbook create1(String id, String title, String publish, String call, String year){
        Cnbook cnbook = new Cnbook(id,title,publish,call,year);
        //Book book = new Book(id,title,publish,call,year);
        //Cnbook cnbook = (Cnbook) book;
        return cnbookDao.save(cnbook);
    }
    //删除
    public void deleteById1(String id){
        cnbookDao.deleteById(id);
    }
    public void deleteByTitle1(String title){
        cnbookDao.deleteByTitle(title);
    }
    //更新修改
    public Cnbook updateByNode1(String id,String title,String publish,String call,String year){
        return cnbookDao.updateByNode(id, title, publish, call, year);
    }
    //查询
    public List<Cnbook> findByTitle1(String title){
        return cnbookDao.findByTitle(title);
    }
    //public Cnbook findByName1(String name){return cnbookDao.findByName(name);}
    public Cnbook findByBookId1(String id){
        return cnbookDao.findByBookId(id);
    }
    public List<Cnbook> find1(String name){return cnbookDao.findByTitleLike(name); }
    //查询25个
    public List<Cnbook> all1(){return cnbookDao.all1();}
    //关系数量
    public Integer count1(String id){return cnbookDao.countcn(id);}



    @Autowired
    FgbookDao fgbookDao;
    //增加
    public Fgbook create2(String id, String title, String publish, String call, String year){
        Fgbook fgbook = new Fgbook(id,title,publish,call,year);
        //Book book = new Book(id,title,publish,call,year);
        //Cnbook cnbook = (Cnbook) book;
        return fgbookDao.save(fgbook);
    }
    //删除
    public void deleteById2(String id){
        fgbookDao.deleteById(id);
    }
    public void deleteByTitle2(String title){
        fgbookDao.deleteByTitle(title);
    }
    //更新修改
    public Fgbook updateByNode2(String id,String title,String publish,String call,String year){
        return fgbookDao.updateByNode(id, title, publish, call, year);
    }
    //查询
    public List<Fgbook> findByTitle2(String title){
        return fgbookDao.findByTitle(title);
    }
    public Fgbook findByBookId2(String id){
        return fgbookDao.findByBookId(id);
    }
    public List<Fgbook> find2(String name){return fgbookDao.findByTitleLike(name);}
    //查询25个
    public List<Fgbook> all2(){return fgbookDao.all2();}
    //关系数量
    public Integer count2(String id){return fgbookDao.countfg(id);}


    @Autowired
    MscbookDao mscbookDao;
    //增加
    public Mscbook create3(String id, String title, String publish, String call, String year){
        Mscbook mscbook = new Mscbook(id,title,publish,call,year);
        //Book book = new Book(id,title,publish,call,year);
        //Cnbook cnbook = (Cnbook) book;
        return mscbookDao.save(mscbook);
    }
    //删除
    public void deleteById3(String id){
        mscbookDao.deleteById(id);
    }
    public void deleteByTitle3(String title){
        mscbookDao.deleteByTitle(title);
    }
    //更新修改
    public Mscbook updateByNode3(String id,String title,String publish,String call,String year){
        return mscbookDao.updateByNode(id, title, publish, call, year);
    }
    //查询
    public List<Mscbook> findByTitle3(String title){
        return mscbookDao.findByTitle(title);
    }
    public Mscbook findByBookId3(String id){
        return mscbookDao.findByBookId(id);
    }
    public List<Mscbook> find3(String name) {return mscbookDao.findByTitleLike(name);}
    //查询25个
    public List<Mscbook> all3(){return mscbookDao.all3();}
    //关系数量
    public Integer count3(String id){return mscbookDao.countmsc(id);}



    @Autowired
    MulbookDao mulbookDao;
    //增加
    public Mulbook create4(String id, String title, String publish, String call, String year){
        Mulbook mulbook = new Mulbook(id,title,publish,call,year);
        //Book book = new Book(id,title,publish,call,year);
        //Cnbook cnbook = (Cnbook) book;
        return mulbookDao.save(mulbook);
    }
    //删除
    public void deleteById4(String id){
        mulbookDao.deleteById(id);
    }
    public void deleteByTitle4(String title){
        mulbookDao.deleteByTitle(title);
    }
    //更新修改
    public Mulbook updateByNode4(String id,String title,String publish,String call,String year){
        return mulbookDao.updateByNode(id, title, publish, call, year);
    }
    //查询
    public List<Mulbook> findByTitle4(String title){
        return mulbookDao.findByTitle(title);
    }
    public Mulbook findByBookId4(String id){
        return mulbookDao.findByBookId(id);
    }
    public List<Mulbook> find4(String name){return mulbookDao.findByTitleLike(name);}
    //查询25个
    public List<Mulbook> all4(){return mulbookDao.all4();}
    //关系数量
    public Integer count4(String id){return mulbookDao.countmul(id);}


    @Autowired
    PapbookDao papbookDao;
    //增加
    public Papbook create5(String id, String title, String publish, String call, String year){
        Papbook papbook = new Papbook(id,title,publish,call,year);
        //Book book = new Book(id,title,publish,call,year);
        //Cnbook cnbook = (Cnbook) book;
        return papbookDao.save(papbook);
    }
    //删除
    public void deleteById5(String id){
        papbookDao.deleteById(id);
    }
    public void deleteByTitle5(String title){
        papbookDao.deleteByTitle(title);
    }
    //更新修改
    public Papbook updateByNode5(String id,String title,String publish,String call,String year){
        return papbookDao.updateByNode(id, title, publish, call, year);
    }
    //查询
    public List<Papbook> findByTitle5(String title){
        return papbookDao.findByTitle(title);
    }
    public Papbook findByBookId5(String id){
        return papbookDao.findByBookId(id);
    }
    public List<Papbook> find5(String name){return papbookDao.findByTitleLike(name);}
    //查询25个
    public List<Papbook> all5(){return papbookDao.all5();}
    //关系数量
    public Integer count5(String id){return papbookDao.countpap(id);}


    @Autowired
    PerbookDao perbookDao;
    //增加
    public Perbook create6(String id, String title, String publish, String call, String year){
        Perbook perbook = new Perbook(id,title,publish,call,year);
        //Book book = new Book(id,title,publish,call,year);
        //Cnbook cnbook = (Cnbook) book;
        return perbookDao.save(perbook);
    }
    //删除
    public void deleteById6(String id){
        perbookDao.deleteById(id);
    }
    public void deleteByTitle6(String title){
        perbookDao.deleteByTitle(title);
    }
    //更新修改
    public Perbook updateByNode6(String id,String title,String publish,String call,String year){
        return perbookDao.updateByNode(id, title, publish, call, year);
    }
    //查询
    public List<Perbook> findByTitle6(String title){
        return perbookDao.findByTitle(title);
    }
    public Perbook findByBookId6(String id){
        return perbookDao.findByBookId(id);
    }
    public List<Perbook> find6(String name){return perbookDao.findByTitleLike(name);}
    //查询25个
    public List<Perbook> all6(){return perbookDao.all6();}
    //关系数量
    public Integer count6(String id){return perbookDao.countper(id);}
}
